#ifndef JCQUEUEDEF_H
#define JCQUEUEDEF_H
#include<list>
#include<mutex>


template<class T>
class JCMediaQueue :public std::list<T>
{
public:
    JCMediaQueue(){

    }
    ~JCMediaQueue(){

    }

    void enqueue(const T &t){
        m_mutex.lock();
        printf("in\n");
        std::list<T>::push_back(t);
        m_mutex.unlock();

    }

    T dequeue(){
        m_mutex.lock();
        T t = NULL;
        if(!std::list<T>::empty()){
            t = std::list<T>::front();
            std::list<T>::pop_front();
            m_mutex.unlock();
            return t;
        }

        m_mutex.unlock();
        return NULL;
    }

    bool isEmpty(){
        m_mutex.lock();
        bool b = std::list<T>::empty();
        m_mutex.unlock();
        return b;
    }
    





private:
    std::mutex m_mutex;

};























#endif